<%@codepage="65001"%>
<%session.codepage="65001"%>
<!-- #include virtual=/inc/dbConn.asp -->
<!-- #include virtual=/inc/function.asp -->
<%
	xMode = Request("xMode")
	showSubMenu = "80"
	stDate = left(date(),8) & "01"

	'## 계정 정보
	SQL = "SELECT accountCd, accountNm FROM tblAccount WHERE part='IN' AND flag='Y' ORDER BY accountNm" 

	Set Rs=Server.CreateObject("ADODB.RecordSet")
	Rs.open SQL, DbCon, 1
	
	If Rs.eof Or Rs.bof Then 
	Else 
		Do Until Rs.eof Or Rs.bof		
			accOption = accOption & "<option value=""" & rs("accountCd") & """>" & rs("accountNm") & "</option>" & vbCrlf
		Rs.movenext
		Loop 
	End If
	
	'## 부서 정보
	Set partRs=Server.CreateObject("ADODB.RecordSet")
	SQL = "SELECT itemCd, itemNm FROM tblComCode WHERE flag='Y' AND groupCd='0005' ORDER BY itemSeq"	
	partRs.open SQL, dbCon
	
	If partRs.eof Or partRs.bof Then 
	Else 
		Do Until partRs.eof Or partRs.bof
			partOptions = partOptions & "<option value='" & partRs("itemCd") & "'>" & partRs("itemNm") & "</option>" & vbCrlf
		partRs.movenext
		Loop 
	End If
%>
<!-- #include virtual=/inc/header_cross.inc.asp -->  

<script language="javascript">    
		 $(document).ready(function() {
			  var clareCalendar = {
			   monthNamesShort: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
			   dayNamesMin: ['일','월','화','수','목','금','토'],
			   weekHeader: 'Wk',
			   dateFormat: 'yy-mm-dd',														// 날짜형식(2012-03-03)
			   autoSize: false,																	//자동리사이즈(false 이면 상위 정의에 따름)
			   changeMonth: true,															// true이면 월변경, false이면 월변경못함
			   changeYear: true,																// true이면 년변경, false이면 년변경못함
			   showMonthAfterYear: true,													//년 뒤에 월 표시
			   buttonImageOnly: true,														//이미지표시
			   //buttonText: '달력선택',														//버튼 텍스트 표시
			   //buttonImage: '/calendar.gif',												//이미지주소
			   //showOn: "both",																//엘리먼트와 이미지 동시 사용(both,button)
			   yearRange: 'c-99:c+99',													//1990년부터 2020년까지
			   maxDate: '+2Y',																	// 오늘부터6년후날짜까지만, '+0d' 오늘 이전 날짜만 선택
			   minDate: '-5y'
			  };
			  $("#stDate").datepicker(clareCalendar);
			  $("#endDate").datepicker(clareCalendar);
			  $("#incomeDt").datepicker(clareCalendar);
			  $("#actionDt").datepicker(clareCalendar);
			  $("#bankDt").datepicker(clareCalendar);
			  $("img.ui-datepicker-trigger").attr("style","margin-left:5px; vertical-align:middle; cursor:pointer;"); //이미지버튼 style적용
			  $("#ui-datepicker-div").hide(); //자동으로 생성되는 div객체 숨김  
		});
		
	   $(window).load(function(){
	       grid01List(1);
	       fnCommonInit();
	    });     
</script>

<BODY topmargin="0" leftmargin="0">
<!-- #include virtual=/inc/menu.inc.asp -->  

<!-- 검색 영역 시작 -->
<div style="text-align:left;margin-top:10px;">
<!-- #include virtual=/inc/subMenu.inc.asp --> 
<table border="0" cellpadding="0" cellspacing="0" width="1385" style="margin-left:5px;">
	<form name="frmSearch"> 
	<tr height="40">
		<td style="padding: 0px 0 0px 10px;background-image:url(/inc/layout/panel-title-light-bg.gif);font-weight:bold;text-align:left" width="100%" class="lTD_trbl">
			<select name="keyset" id="keyset">
				<option value="incomeDt">발행일</option>
				<option value="actionDt">입금일</option>
				<option value="bankDt">통장일</option>
			</select> <input type="text" name="stDate" id="stDate" class="inputBox" style="text-align:center;width:80px" value="<%=stDate%>" onBlur="fnResetTerms('')"> ~ <input type="text" name="endDate" id="endDate" class="inputBox" style="text-align:center;width:80px" value="<%=Date()%>" onBlur="fnResetTerms('')"> 
			<select id="findMnth" onChange="fnResetTerms('t')">
				<option value="">-월-</option>
				<option value="01">01월</option>
				<option value="02">02월</option>
				<option value="03">03월</option>
				<option value="04">04월</option>
				<option value="05">05월</option>
				<option value="06">06월</option>
				<option value="07">07월</option>
				<option value="08">08월</option>
				<option value="09">09월</option>
				<option value="10">10월</option>
				<option value="11">11월</option>
				<option value="12">12월</option>
			</select>
			&nbsp; 내역 <input type="text" name="findIncome" id="findIncome" class="inputBox" style="width:150px;ime-Mode:active"> &nbsp; 
			<select name="findAccountCd" id="findAccountCd" style="width:100px;">
				<option value="">-계 정-</option>
				<%=accOption%>
			</select> &nbsp;
			<select name="findPart" id="findPart">
				<option value="">-부서-</option>
				<%=partOptions%>
			</select> &nbsp;
			 거래처 <input type="text" name="findComapny" id="findComapny" size="12" class="inputBox" onblur="fnFindCompany(this.value,'','findCompCd')"> <select name="findCompCd" id="findCompCd" style="width:150px"><option value="">--거래처--</option></select>
			<input type="button" onClick="grid01List()" value="검 색" class="inputBtn">&nbsp;
			<input type="button" onClick="fnSearchReset()" value="Reset" class="inputBtn">
		</td>
	</tr>
	</form>
</table>
</div>
<!-- 검색 영역 끝 -->


<br>

<!-- 그리드 시작 -->
<div style="text-align:left">
<table border="0" cellpadding="0" cellspacing="0" width="1385" style="margin-left:5px;text-align:left">
	<tr>
		<td width="100%" class="lTD_trbl" valign="top" style="padding: 5px 5px 5px 5px;">
			<table border="0" cellpadding="0" cellspacing="0" width="915">
				<tr height="24">
					<td style="padding: 0 0 0 0;text-align:left" width="400"><input type="button" class="subTitleBtn" style="width:80px;" value="회계(입금)" ReadOnly>&nbsp;<a href="javascript:grid01List()">[새로고침]</a> &nbsp; </td>
					<td style="padding: 0 20px 0 0;" align="right" width="515"><B>Total :</B> <span id="grid01Cnt" style="font-weight:bold">0</span></td>
				</tr>
			</table>
			<table border="0" cellpadding="0" cellspacing="0" width="915"><tr><td style="background-color:#3366CC;height:2px"></td></tr></table>				
			<div id="grid1">
				<div id="gridHeader1">
					<div style="width:40px"><p>No.</p></div>
					<div style="width:60px"><p>발행일</p></div>
					<div style="width:50px"><p>부서</p></div>
					<div style="width:60px"><p>계 정</p></div>
					<div style="width:180px"><p>내 역</p></div>
					<div style="width:110px"><p>거래처</p></div>
					<div style="width:95px"><p>금액</p></div>
					<div style="width:95px"><p>원금／세금</p></div>
					<div style="width:50px"><p>입금일</p></div>
					<div style="width:95px"><p>입금액</p></div>
					<div style="width:50px"><p>통장일</p></div>
					<div style="width:18px">&nbsp;</div>
				</div>
				<div id="noResult1">
					<div><p>결과가 없습니다.</p></div>
				</div>
				<div id="gridBody1" style="display:none;">								
				</div>
				<div id="gridTail1" style="">
					<div class="term"></div>
					<div id="pager1"></div>
				</div>
			</div>		
		</td>
		<td valign="top" style="text-align:center; padding-left:5px">	
			<table border="0" cellpadding="0" cellspacing="0" width="450">
				<tr>
				  <td width="100%" class="lTD_trbl" style="padding: 5px 5px 5px 5px; text-align:left">	
				  	<div id="layerSum1" style="display:">
						<table border="0" cellpadding="0" cellspacing="0" width="440">
							<tr height="24">
								<td style="padding: 0 0 0 0;text-align:left" width="300"><input type="button" class="subTitleBtn" style="width:90px;" value="회사별합계" ReadOnly> <input type="button" class="subTitleBtnGray" onClick="grid02List(1)" style="width:90px;cursor:pointer" value="계정별합계" ReadOnly>&nbsp;<a href="javascript:grid03List()">[새로고침]</a> &nbsp; </td>
								<td style="padding: 0 20 0 0;" align="right" width="140"><B>Total :</B> <span id="grid03Cnt" style="font-weight:bold">0</span></td>
							</tr>
						</table>
						<table border="0" cellpadding="0" cellspacing="0" width="440"><tr><td style="background-color:#3366CC;height:2px"></td></tr></table>					
						<div id="grid3">
							<div id="gridHeader3">
								<div style="width:40px"><p>No.</p></div>
								<div style="width:106px"><p>회 사</p></div>
								<div style="width:90px"><p>총금액</p></div>
								<div style="width:90px"><p>입금액</p></div>
								<div style="width:90px"><p>미수금</p></div>
								<!--<div style="width:90px"><p>원금／세금</p></div>-->
								<div style="width:18px">&nbsp;</div>
							</div>
							<div id="noResult3">
								<div><p>결과가 없습니다.</p></div>
							</div>
							<div id="gridBody3" style="display:none;">								
							</div>
							<div id="gridTail3" style="">
								<div class="term"></div>
								<div id="pager3"></div>
							</div>
						</div>		
					</div>
				  	<div id="layerSum2" style="display:none">	
						<table border="0" cellpadding="0" cellspacing="0" width="440">
							<tr height="24">
								<td style="padding: 0 0 0 0;text-align:left" width="300"><input type="button" class="subTitleBtnGray" style="width:90px;cursor:pointer" value="회사별합계" onClick="grid03List(1)" ReadOnly> <input type="button" class="subTitleBtn" style="width:90px;" value="계정별합계" ReadOnly>&nbsp;<a href="javascript:grid02List()">[새로고침]</a> &nbsp; </td>
								<td style="padding: 0 20 0 0;" align="right" width="140"><B>Total :</B> <span id="grid02Cnt" style="font-weight:bold">0</span></td>
							</tr>
						</table>
						<table border="0" cellpadding="0" cellspacing="0" width="440"><tr><td style="background-color:#3366CC;height:2px"></td></tr></table>			
						<div id="grid2">
							<div id="gridHeader2">
								<div style="width:40px"><p>No.</p></div>
								<div style="width:106px"><p>계 정</p></div>
								<div style="width:90px"><p>총금액</p></div>
								<div style="width:90px"><p>입금액</p></div>
								<!--<div style="width:90px"><p>원금／세금</p></div>-->
								<div style="width:90px"><p>미수금</p></div>
								<div style="width:18px">&nbsp;</div>
							</div>
							<div id="noResult2">
								<div><p>결과가 없습니다.</p></div>
							</div>
							<div id="gridBody2" style="display:none;">								
							</div>
							<div id="gridTail2" style="">
								<div class="term"></div>
								<div id="pager2"></div>
							</div>
						</div>		
					</div>
				  </td>
			   </tr>
			</table>
			<br>
			<table border="0" cellpadding="0" cellspacing="0" width="450">
				<tr>
				  <td width="100%" class="lTD_trbl" style="padding: 5px 5px 5px 5px; text-align:center">
					<table border="0" cellpadding="0" cellspacing="0" width="440">
						<form name="frmAccOut">
						<input type="hidden" name="seq" id="seq">
						<input type="hidden" name="billCd" id="billCd">
						<input type="hidden" name="billMemo" id="billMemo">
						<input type="hidden" name="incSeq" id="incSeq">
						<tr>
							<td height="30" width="440" class="lTD_00b0" style="padding: 0 0 0 20px; text-align:left; font-weight:bold">
								내 &nbsp; &nbsp; &nbsp; &nbsp;역 &nbsp; : &nbsp; <input type="text" name="income" id="income" size="43" class="specialBox"> &nbsp;&nbsp;
							</td>
						</tr>
						<tr>
							<td height="30" width="440" class="lTD_00b0" style="padding: 0 0 0 20px; text-align:left; font-weight:bold">
								계 &nbsp; &nbsp; &nbsp; &nbsp;정 &nbsp; : &nbsp;
								<select name="accountCd" id="accountCd" style="width:110px; color:#ff9900">
									<option value="">-계 정-</option>
									<%=accOption%>
								</select>&nbsp; &nbsp; &nbsp; 입 &nbsp; 금 &nbsp;일 &nbsp; : &nbsp; <input type="text" name="incomeDt" id="incomeDt" size="12" class="specialBox" style="text-align:center" value="<%=Date()%>">
							</td>
						</tr>
						<tr>
							<td height="30" width="440" class="lTD_00b0" style="padding: 0 0 0 20px; text-align:left; font-weight:bold">
								금 &nbsp; &nbsp; &nbsp; &nbsp;액 &nbsp; : &nbsp; <input type="text" name="amount" id="amount" size="20" class="specialBox" onBlur="$('#orgAmount').val(this.value);" style="text-align:right;padding-right:3px"  onKeyup="commify(this.value,'document.frmAccOut.amount')"> &nbsp;<a href="javascript:fnSetTax()" style="margin-right:18px">[↓]TAX</a>
								<select name="part" id="part">
									<option value="">-부서-</option>
									<%=partOptions%>
								</select>
							</td>
						</tr>
						<tr>
							<td height="30" width="440" class="lTD_00b0" style="padding: 0 0 0 20px; text-align:left; font-weight:bold">
								원 &nbsp; &nbsp; &nbsp; &nbsp;금 &nbsp; : &nbsp; <input type="text" name="orgAmount" id="orgAmount" size="20" class="specialBox" style="text-align:right;padding-right:3px"  onKeyup="commify(this.value,'document.frmAccOut.orgAmount')"> &nbsp; 세 금: <input type="text" name="tax" id="tax" style="text-align:right;width:119px;padding-right:3px" class="inputBox"  onKeyup="commify(this.value,'document.frmAccOut.tax')">
							</td>
						</tr>
						<tr>
							<td height="30" width="440" class="lTD_00b0" style="padding: 0 0 0 20px; text-align:left; font-weight:bold">
								거 &nbsp;래&nbsp; 처 &nbsp;&nbsp; : &nbsp; <input type="text" name="company" id="company" size="15" class="inputBox" onblur="fnFindCompany(this.value,'','compCd')"> 
								<select name="compCd" id="compCd" style="width:150px"><option value="">--거래처--</option></select> &nbsp; <A alt="지급액 동일하게 설정" href="javascript:fnSetSame();">[↓]</a> <A alt="날짜, 지급액 동일하게 설정" href="javascript:fnSetSame();fnSetSameDt();">[↓↓]</a>
							</td>
						</tr>
						<tr>
							<td height="30" width="440" class="lTD_00b0" style="padding: 0 0 0 20px; text-align:left; font-weight:bold">
								메 &nbsp; &nbsp; &nbsp; &nbsp;모 &nbsp; : &nbsp; <input type="text" name="memo" id="memo" size="35" class="inputBox" style="margin-right:20px">								
								<select name="flag" id="flag">
									<option value="Y">사용중</option>
									<option value="N">중지</option>
								</select>
							</td>
						</tr>
						<tr>
							<td height="30" width="440" class="lTD_00b0" style="padding: 0 0 0 20px; text-align:left; font-weight:bold;background-color:#f0faff">
								입 &nbsp; 금 &nbsp;액 &nbsp; : &nbsp; <input type="text" name="incAmount" id="incAmount" class="inputBox" style="text-align:right;padding-right:3px;width:160px"  onKeyup="commify2(this)">
							</td>
						</tr>
						<tr>
							<td height="30" width="440" class="lTD_00b0" style="padding: 0 0 0 20px; text-align:left; font-weight:bold;background-color:#f0faff">
								입 &nbsp; 금 &nbsp;일 &nbsp; : &nbsp; <input type="text" name="actionDt" id="actionDt" size="12" class="inputBox" style="text-align:center" value="<%=Date()%>"> &nbsp; 
								통 &nbsp; 장 &nbsp;일 &nbsp; : &nbsp; <input type="text" name="bankDt" id="bankDt" size="12" class="inputBox" style="text-align:center" value="<%=Date()%>">
							</td>
						</tr>
						<tr>
							<td height="30" width="440" class="lTD_00b0" style="padding: 0 0 0 20px; text-align:left; font-weight:bold;background-color:#f0faff">
								입금 &nbsp;메모 &nbsp; : &nbsp; <input type="text" name="incMemo" id="incMemo" size="42" class="inputBox"> &nbsp;&nbsp;
							</td>
						</tr>
						<tr>
							<td height="30" width="440" class="lTD_00b0" style="padding: 0 0 0 20px; text-align:left; font-weight:bold">
								<select name="incFlag" id="incFlag" style="margin-right:60px">
									<option value="Y">사용중</option>
									<option value="N">중지</option>
								</select> &nbsp; &nbsp;<!--<input type="text" id="accessInfo" style="font-weight:normal;width:250px; border:0px">-->
								<input type="button" value="지급추가" class="inputBtn" onClick="fnIncResultReset()" style="margin-left:75px"> 
								<input type="button" value="저장" class="inputBtn" onClick="fnSave()"> 
								<input type="button" value="신규" class="inputBtn" onClick="fnReset()">
							</td>
						</tr>
						</form>
					</table>
				  </td>
				</tr>
			</table>
		</td>		
	</tr>
</table>
</div>
<!-- 그리그 끝 -->

<script language="javascript">
	setMainMenu();
//	//## 테스트를 위한 기본 값세팅	
//	$("#company").val("아이탱크");
//	$("#owner").val("James");
//	$("#phone").val("02-538-5966");
//	$("#fax").val("02-569-2365");
//	$("#major").val("Jade");
//	$("#cellPhone").val("020-5623-5656");
//	$("#compNo").val("02-232-223369");
//	$("#memo").val("연습입니다. ㅋ");
//	$("#flag").val("Y");
////	$("#compCd").val("4");
</script>
</BODY>
</HTML>